/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Current.BattleUpgradesLib;

import Current.BattleUpgradesLib.Upgrades.OffenseBattleUpgrade;

import java.io.Serializable;

/**
 * @author Fork
 */
public class OffenseUpgrades implements Serializable, Cloneable {

    private OffenseBattleUpgrade offUpgrades;
    private Integer expertSoldiers;

    public OffenseUpgrades(OffenseBattleUpgrade offUpgrades, Integer expertSoldiers) {
        this.offUpgrades = offUpgrades;
        this.expertSoldiers = expertSoldiers;
    }

    public OffenseUpgrades(Integer expertSoldiers) {
        this.offUpgrades = new OffenseBattleUpgrade(0, 0, 0, 0);
        this.expertSoldiers = expertSoldiers;
    }

    public Integer getExpertSoldiers() {
        return expertSoldiers;
    }

    public void setExpertSoldiers(Integer expertSoldiers) {
        this.expertSoldiers = expertSoldiers;
    }

    public OffenseBattleUpgrade getOffUpgrades() {
        return offUpgrades;
    }

    public void setOffUpgrades(OffenseBattleUpgrade offUpgrades) {
        this.offUpgrades = offUpgrades;
    }

    public Integer getOffenseFromUpgrades() {
        Integer aux = 0;
        if (this.offUpgrades.getCapacity() > 0) {
            if (this.offUpgrades.getHave() >= (int) Math.floor(expertSoldiers / this.offUpgrades.getCapacity())) {
                aux = this.offUpgrades.getOffenseBonus() * (int) Math.floor(expertSoldiers / this.offUpgrades.getCapacity());
            } else {
                aux = this.offUpgrades.getOffenseBonus() * this.offUpgrades.getHave();
            }
        }
        return aux;
    }
}
